package com.ss.android.article.base.feature.user.social;

import android.content.Context;
import android.os.Handler;
import android.os.Message;

import com.bytedance.article.common.c.TTUtils;
import com.bytedance.common.utility.Logger;
import com.ss.android.common.AbsApiThread;
import com.ss.android.common.util.NetworkUtils;
import com.ss.android.http.legacy.a.NameValueImpl;
import com.ss.android.newmedia.NewMediaConstants;

import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

public final class i extends AbsApiThread {
    public long a;
    public long b;
    public long c;
    private final Context d;
    private final Handler e;
    private int f;
    private String g;
    private long h;

    public i(Context arg2, Handler arg3, int arg4, String arg5, long arg6) {
        Context v0 = arg2 != null ? arg2.getApplicationContext() : null;
        this.d = v0;
        this.e = arg3;
        this.f = arg4;
        this.g = arg5;
        this.h = arg6;
    }

    public final void run() {
        int v0 = 17;
        long v8 = 0;
        int v1 = 18;
        try {
            ArrayList v2 = new ArrayList();
            if (this.h > v8) {
                ((List) v2).add(new NameValueImpl("user_id", String.valueOf(this.h)));
                if (this.a > v8) {
                    ((List) v2).add(new NameValueImpl("group_id", String.valueOf(this.a)));
                }

                if (this.b > v8) {
                    ((List) v2).add(new NameValueImpl("comment_id", String.valueOf(this.b)));
                }

                if (this.c > v8) {
                    ((List) v2).add(new NameValueImpl("update_id", String.valueOf(this.c)));
                }

                if (v8 > v8) {
                    ((List) v2).add(new NameValueImpl("post_id", "0"));
                }

                ((List) v2).add(new NameValueImpl("report_type", String.valueOf(this.f)));
                if (!android.support.design.a.isTextEmpty(this.g)) {
                    ((List) v2).add(new NameValueImpl("content", this.g));
                }

                String v2_1 = NetworkUtils.executePost(-1, NewMediaConstants.feedbackV1ReportUser, ((List) v2));
                if (android.support.design.a.isTextEmpty(v2_1)) {
                } else if (!i.isApiSuccess(new JSONObject(v2_1))) {
                    Logger.w("ReportThread", "report error " + v2_1);
                } else if (this.e == null) {
                    v0 = v1;
                } else {
                    this.e.sendEmptyMessage(1034);
                    return;
                }
            }
        } catch (Throwable v0_1) {
            v0 = TTUtils.getErrorCode(this.d, v0_1);
        }

        if (this.e != null) {
            Message v1_1 = this.e.obtainMessage(1035);
            v1_1.arg1 = v0;
            this.e.sendMessage(v1_1);
        }
    }
}

